package com.hackdf.ecographic;

import com.visionapps.demo.swipe.activity.MainActivity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.TextView;

public class Bienvenida extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// Override how this activity is animated into view
		// The new activity is pulled in from the left and the current activity is kept still
		// This has to be called before onCreate
		overridePendingTransition(R.anim.pull_in_from_left, R.anim.hold);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.bienvenida);
		Button continuar = (Button) findViewById(R.id.btnsiguiente);
		TextView texto = (TextView) findViewById(R.id.TEXT);
		
		Typeface tf = Typeface.createFromAsset(Bienvenida.this.getAssets(),"alcefun.otf");
		texto.setTypeface(tf);
		
		Animation animRotateIn_icon = AnimationUtils.loadAnimation(this, R.anim.rotate);
		  texto.startAnimation(animRotateIn_icon);
		
		continuar.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Log.i("entro al onclick", "entro al onclick");
				Intent intent = new Intent(Bienvenida.this, MainActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			    startActivity(intent);
			    overridePendingTransition(R.anim.hold, R.anim.push_out_to_left);
			    finish();
			}
		});
		
	}
	
	@Override
    protected void onPause() {
		// Whenever this activity is paused (i.e. looses focus because another activity is started etc)
		// Override how this activity is animated out of view
		// The new activity is kept still and this activity is pushed out to the left
        overridePendingTransition(R.anim.hold, R.anim.push_out_to_left);
        super.onPause();
    }
}